﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class morning_DelStockInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                string id = Request["id"];
                int Id = int.Parse(id);
                TemporaryModel.TemporaryEntities dal = DAL.DBManager.GetTempEmtity();
                TemporaryModel.StockBusinessInfo sbi = dal.StockBusinessInfo.First(x => x.id == Id);

                dal.StockBusinessInfo.DeleteObject(sbi);
                dal.SaveChanges();
                ClientScript.RegisterStartupScript(GetType(), "delete", "alert('删除成功'),document.location='StockInfo.aspx'", true);
            }
            catch (Exception ex)
            {
                LogYuMin.LogWriter.GetWriter(LogYuMin.LogFile.error).Write(GetType(), "deleteStockBusinessInfo", LogYuMin.LogStates.ERROR, ex);
                ClientScript.RegisterStartupScript(GetType(), "delete", "alert('删除失败')", true);
            }

        }
    }
}